<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>提示词管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
		<!-- jQuery-->
		<script type="text/javascript" src="/static/plugins/jquery/jquery-3.6.0.min.js"></script>

		<!-- layui-->
		<link rel="stylesheet" href="/static/plugins/layui/2.8.4/css/layui.css" media="all">
		<script src="/static/plugins/layui/2.8.4/layui.js" charset="utf-8"></script>

		<!-- 页面样式-->
		<link rel="stylesheet" href="/static/css/eKnow/knowledgeBase.css" media="all">

	</head>
	<style>
		.list-span{
			white-space: pre-line;
			text-overflow:ellipsis;/*设置隐藏部分为省略号*/
			overflow: hidden;/*设置隐藏*/
			display: -webkit-box;
			-webkit-line-clamp: 4;
			-webkit-box-orient: vertical;
		}
	</style>
	<body style="background-color: #F7F7F9;">
		<!--标题-->
		<div class="title-view">

			<div class="title-main"><span>Prompt模版管理</span></div>
			<div class="title-tip">
				<span>什么是Prompt？</span><br>
				<span>Prompt也叫提示词，简单的理解成它是给大模型的指令。</span>
				<span>它可以是一个问题、一段文字描述，甚至可以是带有一堆参数的文字描述。大模型会基于 prompt 所提供的信息，生成对应的文本或者图片。</span>
				<span>它把大模型的输入限定在了一个特定的范围之中，进而更好地控制模型的输出。</span>
				<span>Prompt工程的作用，就是通过提供清晰和具体的指令，引导模型输出生成高相关、高准确且高质量的文本对答内容，属于自然语言处理领域突破的重要工程。</span>
			</div>

		</div>

		<!--内容-->
		<div class="content-view">
			<!--内容顶部按钮-->
			<div class="btn-view">
				<div class="layui-btn-container">

				   <div class="layui-input-group btn-view-search">
				        <input type="text" placeholder="搜索场景名称" class="layui-input" id="nameInput">
				        <div class="layui-input-split layui-input-suffix" style="cursor: pointer;" onclick="searchName();">
							<i class="layui-icon layui-icon-search"></i>
				        </div>
				    </div>
				</div>
			</div>

			<!--内容列表-->
			<div class="layui-bg-white" style="padding: 16px;">
			  <div class="layui-row layui-col-space15" id="sceneList">

			  </div>
			</div>


		</div>


		<script type="text/javascript">
			$(function() {
				getEKnowSceneList("");
			});

			//获取场景列表信息
			function getEKnowSceneList(sceneName){
				$.ajax({
					url: '/api/inter/eKnowScene/getEKnowSceneList',
					data: {'sceneName':sceneName},
					type: 'POST',
					async: false,
					success: function (result) {
						layer.close();
						console.log('result:',result);
						if(result.code=='SUCCESS'){
							var sceneList = result.sceneList;
							if(sceneList!=null && sceneList.length>0){
								var htmlStr = '';
								for(var i=0;i<sceneList.length;i++){
									 htmlStr += '<div class="layui-col-md3">' +
											' <div class="layui-card card-view" onclick="toListPage('+sceneList[i].id+')" >' +
											'   <div class="layui-card-header">' + sceneList[i].sceneName + '</div>' +
											' <div class="layui-card-body card-body-set"><span class="list-span"></span>'+sceneList[i].sceneDescribe+'</div>' +
											' </div>' +
											'</div>';
								}
								$('#sceneList').html(htmlStr);
							}else {
								$('#sceneList').html('<div class="layui-col-md12" style="width: 100%; text-align:center;">暂无场景信息</div>');
							}
							setDropdown();
						}else {//失败
							layer.close();
							layer.msg('不好意思，系统出现问题了，请稍后重试！', {icon: 2});
						}
					},
					error: function () {
						layer.close();
						layer.msg('不好意思，系统出现问题了，请稍后重试！', {icon: 2});
					}
				});
			}
			//查询按钮
			function searchName() {
				layui.layer.msg('加载中', {icon: 16,shade: 0.01});
				var nameInput = $('#nameInput').val();
				getEKnowSceneList(nameInput==null?'':nameInput);
				setDropdown();
			}


		function toListPage(id){
			layer.open({
				type: 2,
				offset: 'r',
				anim: 'slideLeft', // 从右往左
				title: false,
				area: ['100%', '100%'],
				shade: 0.1,
				shadeClose: false,
				closeBtn:0,
				content: '/web/eKnowAi/webEKnowAiController/eknowTemplateList?id='+id
			});
		}
		</script>
	</body>
</html>


